package org.cangdu.elm.controller;

import org.cangdu.elm.mongo.domain.Cities;
import org.cangdu.elm.mongo.domain.City;
import org.cangdu.elm.mongo.service.ICitiesService;
import org.cangdu.elm.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: weiRong
 * @Date: 2021/08/25/17:21
 * @Description:
 */
@RestController
@RequestMapping("/v1")
public class CityController {
    @Autowired
    private ICitiesService citiesService;


    @GetMapping("/cities")
    public Object list(String type){
        List<Map<String, City>> maps = citiesService.queryByType(type);
        return JsonResult.success(maps);
    }

    @GetMapping("/{id}")
    public Object get(int id){
       return null;
    }
}
